(function() {
  var __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  this.AdminResponseListingModel = (function(_super) {

    __extends(AdminResponseListingModel, _super);

    function AdminResponseListingModel() {
      return AdminResponseListingModel.__super__.constructor.apply(this, arguments);
    }

    AdminResponseListingModel.ListingUrl = '';

    AdminResponseListingModel.prototype.initialize = function() {
      if (AdminResponseListingModel.ListingUrl.length === 0) {
        return AdminResponseListingModel.ListingUrl = SiteMap.Admin.Responses.Listing;
      }
    };

    AdminResponseListingModel.prototype.defaults = {
      Size: 10,
      Page: 1,
      Direction: 0,
      Responses: [],
      Column: "UserEmail",
      Filter: {
        UserId: '',
        BookId: '',
        UserEmail: '',
        BookTitle: '',
        DateFrom: '',
        DateTo: ''
      }
    };

    AdminResponseListingModel.prototype.url = function() {
      var url;
      url = AdminResponseListingModel.ListingUrl;
      url += "?page=" + this.attributes.Page;
      url += "&size=" + this.attributes.Size;
      url += "&Column=" + this.attributes.Column;
      url += "&Direction=" + this.attributes.Direction;
      url += "&Filter.UserId=" + this.attributes.Filter.UserId;
      url += "&Filter.BookId=" + this.attributes.Filter.BookId;
      url += "&Filter.UserEmail=" + this.attributes.Filter.UserEmail;
      url += "&Filter.BookTitle=" + this.attributes.Filter.BookTitle;
      url += "&Filter.DateFrom=" + this.attributes.Filter.DateFrom;
      url += "&Filter.DateTo=" + this.attributes.Filter.DateTo;
      SiteMap.Admin.Responses.Listing = encodeURI(url);
      return SiteMap.Admin.Responses.Listing;
    };

    AdminResponseListingModel.prototype.parse = function(response) {
      var attrs;
      attrs = {
        Size: response.Size,
        Page: response.Page,
        TotalPages: response.TotalPages,
        Column: response.Column,
        Direction: response.Direction,
        Filter: this.attributes.Filter
      };
      attrs.Responses = response.Responses;
      if (response.Filter.UserId != null) {
        attrs.Filter.UserId = response.Filter.UserId;
      }
      if (response.Filter.BookId != null) {
        attrs.Filter.BookId = response.Filter.BookId;
      }
      if (response.Filter.UserEmail != null) {
        attrs.Filter.UserEmail = response.Filter.UserEmail;
      }
      if (response.Filter.BookTitle != null) {
        attrs.Filter.BookTitle = response.Filter.BookTitle;
      }
      if (response.Filter.DateFromAsString != null) {
        attrs.Filter.DateFrom = response.Filter.DateFromAsString;
      }
      if (response.Filter.DateToAsString != null) {
        attrs.Filter.DateTo = response.Filter.DateToAsString;
      }
      return attrs;
    };

    return AdminResponseListingModel;

  })(ListingModel);

}).call(this);
